<template>
<!--    轮播图-->
    <div>
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="#FD7304">
            <van-swipe-item v-for="(item,index) in list" :key="index">
<!--                点击进入新闻页面-->
                <router-link :to="'/NewsPage/'+item.articleId">
                    <img :src='item.bannerImgUrl' alt="">
                </router-link>
            </van-swipe-item>
        </van-swipe>
    </div>
</template>

<script>
    import {getSwiper} from "../../api/GoodNews";

    export default {
        name: "Swiper",
        data(){
            return{
            list:[]
            }
        },
        created() {
            getSwiper(1,4).then(res=>{
                this.list = res.rows
            })
        }
    }
</script>

<style scoped>
    .van-swipe-item{
        width: 100%;
        height: 200px;
    }
    .my-swipe img{
        width: 100%;
    }
</style>